package com.ljx.itbbs.server.mall.domain.enums;

import com.ljx.itbbs.server.user.domain.enums.RoleEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-03-31  10:51
 */
@Getter
@AllArgsConstructor
public enum CouponSeckillEnum {

    NO_STOCK(1L, "库存不足"),
    IS_HAVE(2L, "请勿重复领取"),
    OK(0L, "完成");

    private Long type;
    private String desc;
    private static Map<Long, CouponSeckillEnum> cache;

    static {
        cache = Arrays.stream(CouponSeckillEnum.values()).collect(Collectors.toMap(CouponSeckillEnum::getType, Function.identity()));
    }

    public static CouponSeckillEnum of(Long type) {
        return cache.get(type);
    }

}
